<html>
<head>
    <title>风险责任清单</title>
    <link rel="stylesheet" href="../../../assets/theme-chalk/index.css">
    <link rel="stylesheet" href="../../../style.css">

    <style>
        body {
            background: #F0F2F6;
        }

        .main-head {
            background: #fff;
            padding-left: 10px;
            padding-top: 10px;
            margin-bottom: 0px;
            border: solid 1px #fff;
        }

        .chart-outer {
            height: 200px;
        }

        img {
            width: 30px;
            width: 32px;
        }

        td {
            text-align: center;
            height: 50px; /*这里需要自己调整，根据自己的需求调整高度*/
            position: relative;
        }

        td[class=first] {
            width: 100px;
        }

        td[class=first]:before {
            content: "";
            position: absolute;
            width: 1px;
            height: 160px;
            top: 0;
            left: 0;
            background-color: #000;
            display: block;
            transform: rotate(-73deg);
            transform-origin: top;
            -ms-transform: rotate(-73deg);
            -ms-transform-origin: top;
        }

        .title1 {
            position: absolute;
            top: 0px;
            right: 0px;
        }

        .title2 {
            position: absolute;
            top: 26px;
            right: 70px;
        }

        .el-dialog {
            position: absolute;
            top: 50%;
            left: 50%;
            margin: 0 !important;
            transform: translate(-50%, -50%);
            display: flex;
            flex-direction: column;
            max-height: calc(100% - 30px);
            width: 100%;
            /*max-width: calc(100% - 30px);*/
        }
    </style>
</head>
<body>
<div class="page" id="page-monitor" style="display: none">
    <div class="page-main">
        <div class="main-head">
            <el-form :inline="true" size="small" :model="searchForm">
                <el-form-item label="预案名称">
                    <el-input placeholder="预案名称" style="width: 150px;" v-model="PreName"></el-input>
                </el-form-item>

                <el-form-item label="预案类型">
                    <el-select v-model="PreType" style="width: 200px">
                        <el-option
                                v-for="item in DangerousData"
                                :key="item.Id"
                                :label="item.Name"
                                :value="item.Id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="btnSearch">查询</el-button>
                    <el-button type="success" @click="btnAdd">新增</el-button>
                </el-form-item>
            </el-form>
        </div>
        <el-table :data="tableData" :stripe="true" :border="true" size="mini" style="width: 100%">
            <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
            <el-table-column prop="PreName" label="预案名称" align="center"></el-table-column>
            <el-table-column prop="PreTypeName" label="预案类型" align="center"></el-table-column>
            <el-table-column prop="InvolvedPlace" label="关联场所" align="center">
            </el-table-column>
            <el-table-column prop="file" label="下载文件">
                <template slot-scope="scope">
                    <el-link :href="webRoot + scope.row.file" type="primary" target="_blank">下载</el-link>
                </template>
            </el-table-column>
            <el-table-column label="操作" align="center" width="280">
                <template slot-scope="scope">
                    <el-button round icon="el-icon-setting" size="mini"
                               @click="handleEdit(scope.row.PreId)" type="info">编辑
                    </el-button>
                    <el-button size="mini" round type="primary" icon="el-icon-upload"
                               @click="handleUpload(scope.row)"></el-button>
                    <el-button @click="delPreplan(scope.row.Id)" round size="mini" icon="el-icon-delete"
                               type="danger">删除
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <div class="page-footer">
            <el-pagination background layout="prev, pager, next" :pagesize="pagesize" :total="totalCount"
                           :current-page.sync="pageno" @current-change="onChangePage">
            </el-pagination>
        </div>
    </div>

    <el-dialog :title="'添加'" :visible.sync="addVisible" :show-close="false" width="55%">
        <el-row>
            <el-form ref="addForm" :model="addForm" label-width="120px">
                <el-form-item label="预案名称" prop="PreName" :rules="[
                             {required:true,message:'预案名称!',trigger:'blur'}]">
                    <el-input v-model="addForm.PreName" style="width: 65%;"></el-input>
                </el-form-item>
                <el-form-item label="预案类型" prop="PreType" :rules="[
                             {required:true,message:'预案类型!',trigger:'blur'}]">
                    <el-select v-model="addForm.PreType" style="width: 60%">
                        <el-option
                                v-for="item in DangerousData"
                                :key="item.Id"
                                :label="item.Name"
                                :value="item.Id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="关联风险点" :rules="[
                             {required:true,message:'关联风险点!',trigger:'blur'}]">
                    <el-select v-model="sel_risk" multiple filterable placeholder="请选择，可多选">
                        <el-option
                                v-for="item in RiskData"
                                :key="item.riskNo"
                                :label="item.riskName"
                                :value="item.riskNo">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="关联部门" :rules="[
                             {required:true,message:'关联部门!',trigger:'blur'}]">
                    <el-select v-model="sel_depart" multiple filterable placeholder="请选择，可多选">
                        <el-option
                                v-for="item in DepartmentData"
                                :key="item.DepartmentID"
                                :label="item.DepartmentName"
                                :value="item.DepartmentID">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="关联疏散图">
                    <el-select v-model="sel_map" multiple filterable placeholder="请选择，可多选">
                        <el-option
                                v-for="item in MapData"
                                :key="item.MapId"
                                :label="item.MapName"
                                :value="item.MapId">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="关联场所" prop="InvolvedPlace" :rules="[
                             {required:true,message:'关联场所!',trigger:'blur'}]">
                    <el-input v-model="addForm.InvolvedPlace" style="width: 65%;"></el-input>
                </el-form-item>
                <el-form-item label="文件上传">
                    <!--iot.hzcando.com-->
                    <el-upload
                            class="upload-demo"
                            drag
                            :action="url+'/api/idm/v1/ContingencyPreplan/PreplanAdd'"
                            :headers="headers"
                            name="file"
                            :data="addForm"
                            :on-change="fileChange"
                            :on-success="onSuccess"
                            :on-error="onError"
                            :limit="1"
                            :file-list="fileList"
                            :limit="1"
                            :auto-upload="false"
                            ref="add">
                        <i class="el-icon-upload"></i>
                        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                    </el-upload>
                </el-form-item>
            </el-form>
        </el-row>


        <div slot="footer" class="dialog-footer">
            <el-button @click="addVisible=false">取消</el-button>
            <el-button @click="plan_submit('add')" type="primary">确定</el-button>
        </div>
    </el-dialog>


    <el-dialog :title="'编辑'" :visible.sync="editVisible" :show-close="false" width="55%">
        <el-row>
            <el-form ref="editForm" :model="editForm" label-width="120px">
                <el-form-item label="预案名称" prop="PreName" :rules="[
                             {required:true,message:'预案名称!',trigger:'blur'}]">
                    <el-input v-model="editForm.PreName" style="width: 65%;"></el-input>
                </el-form-item>
                <el-form-item label="预案类型" prop="PreType" :rules="[
                             {required:true,message:'预案类型!',trigger:'blur'}]">
                    <el-select v-model="editForm.PreType" style="width: 200px">
                        <el-option
                                v-for="item in DangerousData"
                                :key="item.Id"
                                :label="item.Name"
                                :value="item.Id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="关联风险点" :rules="[
                             {required:true,message:'关联风险点!',trigger:'blur'}]">
                    <el-select v-model="sel_risk" multiple filterable placeholder="请选择，可多选">
                        <el-option
                                v-for="item in RiskData"
                                :key="item.riskNo"
                                :label="item.riskName"
                                :value="item.riskNo">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="关联部门" :rules="[
                             {required:true,message:'关联部门!',trigger:'blur'}]">
                    <el-select v-model="sel_depart" multiple filterable placeholder="请选择，可多选">
                        <el-option
                                v-for="item in DepartmentData"
                                :key="item.DepartmentID"
                                :label="item.DepartmentName"
                                :value="item.DepartmentID">
                        </el-option>
                    </el-select>
                </el-form-item>


                <el-form-item label="关联疏散图">
                    <el-select v-model="sel_map" multiple filterable placeholder="请选择，可多选">
                        <el-option
                                v-for="item in MapData"
                                :key="item.MapId"
                                :label="item.MapName"
                                :value="item.MapId">
                        </el-option>
                    </el-select>
                </el-form-item>


                <el-form-item label="关联场所" prop="InvolvedPlace" :rules="[
                             {required:true,message:'关联场所!',trigger:'blur'}]">
                    <el-input v-model="editForm.InvolvedPlace" style="width: 65%;"></el-input>
                </el-form-item>
                <el-form-item label="文件上传">
                    <!--iot.hzcando.com-->
                    <el-upload
                            class="upload-demo"
                            drag
                            :action="url+'/api/idm/v1/ContingencyPreplan/PreplanUpdate'"
                            :headers="headers"
                            name="file"
                            :data="editForm"
                            :on-change="fileChange"
                            :on-success="onSuccess"
                            :on-error="onError"
                            :limit="1"
                            :file-list="fileList"
                            :auto-upload="false"
                            ref="edit">
                        <i class="el-icon-upload"></i>
                        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                    </el-upload>
                </el-form-item>
            </el-form>
        </el-row>
        <div slot="footer" class="dialog-footer">
            <el-button @click="editVisible=false">取消</el-button>
            <el-button @click="plan_esubmit('edit')" type="primary">确定</el-button>
        </div>
    </el-dialog>
    <el-dialog title="备案证明材料" :visible.sync="uploadVisible" width="60%" :before-close="handleClose">
        <el-table :data="file_list" style="width: 100%">
            <el-table-column type="index" width="50">
            </el-table-column>
            <el-table-column property="fileName" label="文件名称">
            </el-table-column>
            <el-table-column label="操作" width="120">
                <template slot-scope="scope">
                    <el-button @click="delFile(scope.row)" type="text" size="small">
                        删除
                    </el-button>
                        <el-link :href="webRoot + scope.row.filePath" type="primary" target="_blank">下载</el-link>
                </template>
            </el-table-column>
        </el-table>
        <!--action="http://localhost:10004/api/idm/v1/HighWay/FileUpload"-->
        <el-upload class="upload-demo" ref="upload3" name="filePath" :headers="headers" :data="fileData"
                   :action="url+'/api/idm/v1/HighWay/FileUpload'"
                   :on-change="fileChange1" :auto-upload="false" :on-success="uploadFiles" :on-error="uploadFail"
                   limit="1">
            <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
            <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
        </el-upload>
    </el-dialog>
</div>
<script type='text/javascript' src='../../../assets/bundle.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/bundle.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/jquery-1.11.2.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/echarts.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../js/common.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../js/component.js' charset='utf-8'></script>

<script>

    var vuePage = new Vue({
            el: '#page-monitor',
            data: {
                fileList1: [],
                uploadVisible: false,
                fileData: [],
                url: SiteConfig.webApiset,
                tableData: [],
                searchForm: {
                    pagesize: 10,
                    totalCount: 10,
                    pageno: 1,
                    UserId: SiteConfig.account.id,
                    trainFlag: ''
                },
                editMod: false,
                addVisible: false,
                editVisible: false,
                innerVisible: false,
                checkVisible: false,
                DepartmentVisible: false,
                RiskVisible: false,
                addForm: {},
                editForm: {},
                sel_user: [],
                multipleSelection: [],
                child: [],
                departMent: [],
                file_list: '',
                userDetail: [],
                DangerousData: [
                    {Name: '所有', Id: 0},
                    {Name: '综合预案', Id: 1},
                    {Name: '专项预案', Id: 2},
                    {Name: '现场处置方案', Id: 3}
                ],
                planName: '',
                planType: '',
                pagesize: 10,
                totalCount: 0,
                pageno: 1,
                PlanData: [],
                userData: [],
                RiskData: [],
                DepartmentData: [],
                sel_depart: [],
                checkDatas: [],
                sel_risk: [],
                sel_map: [],
                userDatas: [],
                projectName: '',
                province: '',
                city: '',
                zone: '',
                headers: {
                    uid: '',
                    token: '',
                },
                endTime: '',
                startTime: '',
                DocNo: '',
                PreName: '',
                PreType: '',
                riskName: '',
                grade: '',
                useFlag: '',
                riskType: '',
                fileList: [],
                MapData: [],
                uploadVisible: false,
                webRoot:SiteConfig.webApiset
            },
            methods: {
                submitUpload() {
                    if (this.fileList1.length == 0) {
                        this.$message({
                            type: 'info',
                            message: '必须选择文件'
                        });
                        return;
                    }
                    this.$refs.upload3.submit();
                    this.$refs.upload3.clearFiles();
                    setTimeout(() => {
                        this.getFileList();
                    }, 1000)
                },
                handleClose(done) {
                    this.$refs.upload3.clearFiles();
                    this.fileList1 = [];
                    done();
                },
                handleDown(row) {
                    if (row.filePath) {
                        this.$message.success('导出成功!');
                        window.location = SiteConfig.webApiset + row.filePath;
                    } else {
                        this.$message.warning('无审核文件,请先上传后下载');
                    }
                },
                fileChange1(file, fileList) {
                    this.fileList1 = fileList;
                    this.fileData.fileName = file.name.split('.')[0]
                    console.log(file);
                },
                uploadFail(res) {
                    this.$message({
                        type: 'error',
                        message: '上传错误' + res.errMsg
                    })
                },
                delFile(row) {
                    HttpUtil.get('HighWay/FileDelete', {
                        Id: row.Id
                    }).success((res) => {
                        this.$message.success('删除成功!');
                        this.getFileList();
                    })
                },
                uploadFiles(res) {
                    if (res.state == 0) {
                        this.getFileList();
                    } else {
                        this.$message({
                            type: 'error',
                            message: '上传错误' + res.errMsg
                        })
                    }
                },
                getFileList() {
                    var p = {};
                    p.typeId = this.fileData.typeId;
                    p.type = this.fileData.type;
                    HttpUtil.get('HighWay/FileList', p).success((res) => {
                        this.file_list = res.data;
                        this.uploadVisible = true;
                    })
                },
                handleUpload(row) {
                    this.fileData.typeId = row.Id;
                    this.fileData.type = 2;
                    this.getFileList();
                },
                select_status() {
                    this.$forceUpdate();
                },
                fileChange(file, fileList) {
                    this.fileList = fileList;
                },
                onSuccess(res) {
                    // if (res.state == 0) {
                    this.$message({
                        message: '保存成功！',
                        type: 'success'
                    });

                    this.$refs[this.refs].clearFiles();
                    this.fileList = [];
                    this.addVisible = false;
                    this.editVisible = false;
                    this.getTrain();
                    this.RiskList();

                    // } else {
                    //     this.$message({
                    //         type: 'error',
                    //         message: '报错!' + res.errMsg
                    //     });
                    // }

                },
                onError(err) {
                    this.$message({
                        type: 'error',
                        message: '报错!' + err.errMsg
                    });
                },
                DepartmentClose: function () {
                    this.DepartmentVisible = false;
                    this.DepartmentData = this.DepartmentData1;
                },
                RiskClose: function () {
                    this.RiskVisible = false;
                    this.RiskDatas = this.RiskDatas1;
                },
                cancelClick(name) {
                    switch (name) {
                        case 'addForm':
                            this.addForm = {};
                            this.addVisible = false;
                            break;
                        case 'editForm':
                            this.editVisible = false;
                            this.editForm = {};
                            break;
                    }
                },
                report: function (filename) {
                    window.open(SiteConfig.webApiset + filename);
                },
                RiskSearch: function () {
                    this.RiskList();
                },
                btnSearch: function () {
                    this.getTrain();
                },
                onChangePage(page) {
                    this.pageno = page;
                    this.getTrain();
                },
                btnAdd() {
                    this.refs = 'add';
                    vuePage.sel_risk = [];
                    vuePage.sel_depart = [];
                    vuePage.sel_map = [];
                    this.addVisible = true;
                    this.addForm = {};
                    // this.sel_depart = {};
                    // this.sel_risk = {};
                    this.editMod = false;
                },
                showUser() {
                    this.innerVisible = true;
                },
                del_checkDatas(index) {
                    this.checkDatas.splice(index, 1);
                },
                del_RiskDatas(index) {
                    this.RiskDatas.splice(index, 1);
                },
                del_userDatas(index) {
                    this.userDatas.splice(index, 1);
                },
                handleSelectionChange(val) {
                    this.multipleSelection = val;
                },
                checkCheck() {
                    this.checkVisible = true;
                },
                userCheck() {
                    this.DepartmentVisible = true;
                },
                RiskCheck() {
                    this.RiskVisible = true;
                },
                RiskChange(val) {
                    this.RiskDatas1 = val;
                    console.log(this.RiskDatas)
                },
                userChange(val) {
                    this.userDatas = val;
                    console.log(this.userDatas)
                },
                checkChange(val) {
                    this.checkDatas = val;
                    console.log(this.checkData)
                },

                filterTag(value, row) {
                    return row.attributes.DepartmentID === value;
                },
                plan_submit(name) {
                    // this.$refs.addForm.validate((valid) => {
                    //     if (valid) {
                    //     }
                    // })
                    if (!this.addForm.PreName) {
                        this.$message.warning('请输入预案名称');
                        return;
                    }
                    if (!this.addForm.PreType) {
                        this.$message.warning('请输入预案类型');
                        return;
                    }
                    if (this.sel_risk.length == 0) {
                        this.$message.warning('必须关联风险点');
                        return;
                    }
                    if (this.sel_depart.length == 0) {
                        this.$message.warning('必须关联部门');
                        return;
                    }
                    if (!this.addForm.InvolvedPlace) {
                        this.$message.warning('请输入关联场所');
                        return;
                    }
                    if (this.fileList.length == 0) {
                        this.$message({
                            type: 'info',
                            message: '必须选择文件'
                        });
                        return;
                    }

                    this.addForm.prerisks = this.sel_risk.join(',');
                    this.addForm.predepartments = this.sel_depart.join(',');
                    if (this.sel_map.length > 0)
                        this.addForm.premaps = this.sel_map.join(',');


                    this.addForm.projectNo = SiteConfig.account.projectNo;
                    this.$refs[name].submit();
                    this.addVisible = false;
                    this.$message({
                        message: '添加成功！',
                        type: 'success'
                    });
                    this.getTrain();
                },
                plan_esubmit(name) {
                    if (!this.editForm.PreName) {
                        this.$message.warning('请输入预案名称');
                        return;
                    }
                    if (!this.editForm.PreType) {
                        this.$message.warning('请输入预案类型');
                        return;
                    }
                    if (this.sel_risk.length == 0) {
                        this.$message.warning('必须关联风险点');
                        return;
                    }
                    if (this.sel_depart.length == 0) {
                        this.$message.warning('必须关联部门');
                        return;
                    }
                    if (!this.editForm.InvolvedPlace) {
                        this.$message.warning('请输入关联场所');
                        return;
                    }
                    this.editForm.prerisks = this.sel_risk.join(',');
                    this.editForm.predepartments = this.sel_depart.join(',');

                    if (this.sel_map.length > 0)
                        this.editForm.premaps = this.sel_map.join(',');

                    if (this.fileList.length == 0) {
                        HttpUtil.post('ContingencyPreplan/PreplanUpdate', this.editForm).success((r) => {
                            this.$message({
                                message: '修改成功！',
                                type: 'success'
                            });
                            this.fileList = [];
                            this.editVisible = false;
                            this.getTrain();
                        })
                    } else {
                        this.$refs[name].submit();
                    }

                    // this.$refs[name].submit();
                    // this.editVisible = false;
                    // this.$message({
                    //     message: '修改成功！',
                    //     type: 'success'
                    // });
                    // this.getTrain();
                },
                delPreplan(id) {
                    this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        HttpUtil.get('ContingencyPreplan/PreplanDelete', {Id: id}).success((r) => {
                            this.$message({
                                type: 'success',
                                message: '删除成功!'
                            });
                            this.getTrain();
                        })
                    }).catch(() => {
                        this.$message({
                            type: 'info',
                            message: '已取消删除'
                        });
                    });
                },
                showDetail(id) {
                    this.detailVisible = true;
                    this.getDetail(id);
                },
                handleEdit(PreId) {
                    this.refs = 'edit';
                    vuePage.sel_risk = [];
                    vuePage.sel_depart = [];
                    vuePage.sel_map = [];
                    HttpUtil.get('ContingencyPreplan/PreplanList', {
                        PreId: PreId,
                        projectNo: SiteConfig.account.projectNo
                    }).success((r) => {
                        if (r.state == 0) {
                            this.editForm = {
                                Id: r.data[0].preplandata[0].Id,
                                PreId: r.data[0].preplandata[0].PreId,
                                PreName: r.data[0].preplandata[0].PreName,
                                PreType: parseInt(r.data[0].preplandata[0].PreType),
                                InvolvedPlace: r.data[0].preplandata[0].InvolvedPlace,
                                projectNo: r.data[0].preplandata[0].projectNo,
                                createTime: r.data[0].preplandata[0].createTime,
                                file: r.data[0].preplandata[0].file,
                            };


                            // vuePage.sel_risk = r.data[1].prerisksDatas;
                            var prerisksDatas = r.data[1].prerisksDatas;

                            for (var i = 0; i < prerisksDatas.length; i++) {
                                vuePage.sel_risk.push(prerisksDatas[i].riskNo);
                            }

                            var predepartmentsDatas = r.data[2].predepartmentsDatas;
                            for (var i = 0; i < predepartmentsDatas.length; i++) {
                                vuePage.sel_depart.push(predepartmentsDatas[i].DepartmentID);
                            }

                            var premapsDatas = r.data[3].premapsDatas;
                            for (var i = 0; i < premapsDatas.length; i++) {
                                vuePage.sel_map.push(premapsDatas[i].MapId);
                            }
                            //
                            // // vuePage.checkDatas = checkDatas;
                            // vuePage.RiskDatas = r.data[1].companyDatas;
                            // // this.userDatas = r.data[3].userDatas;
                            // var userData = r.data[2].staffDatas;
                            // var DepartmentData = this.DepartmentData;
                            // for (var i = 0; i < userData.length; i++) {
                            //     for (var j = 0; j < DepartmentData.length; j++) {
                            //         if (userData[i].departmentId == DepartmentData[j].DepartmentID) {
                            //             userData[i].DepartmentName = DepartmentData[j].DepartmentName;
                            //         }
                            //     }
                            // }
                            // vuePage.userDatas = userData;
                            this.editVisible = true;
                            this.editMod = true;
                        }
                        else {
                            this.$message({
                                type: 'error',
                                message: r.errMsg
                            })
                        }

                    })
                },
                getTrain() {
                    var param = {};
                    if (this.PreName)
                        param.PreName = this.PreName;
                    if (this.PreType)
                        param.PreType = this.PreType;


                    param.projectNo = SiteConfig.account.projectNo;
                    param.pageno = this.pageno;
                    param.pagesize = this.pagesize;

                    // this.tableData = [{
                    //     DocDepartmentName: '资料科',
                    //     DocStaff: 10,
                    //     DocTime: '2019-12-11 15:45:34',
                    //     DocName: '环保局',
                    //     DocNo: '环办[2019]119号'
                    //
                    // }]
                    HttpUtil.get('ContingencyPreplan/PreplanList', param).success((res) => {
                        var PreplanList = res.data;
                        this.totalCount = res.total;
                        var DangerousData = this.DangerousData;
                        for (var i = 0; i < PreplanList.length; i++) {
                            for (var j = 0; j < DangerousData.length; j++) {
                                if (PreplanList[i].PreType == DangerousData[j].Id) {
                                    PreplanList[i].PreTypeName = DangerousData[j].Name;
                                }
                            }
                        }
                        this.tableData = PreplanList;
                    })
                },
                getFile() {
                    HttpUtil.get('Training/FileList', {UserId: SiteConfig.account.id}).success((r) => {
                        this.file_list = r.data;
                    })
                },
                getDetail(id) {
                    HttpUtil.get('Training/PeopleDetail', {trainingId: id}).success((r) => {
                        this.userDetail = r.data;
                    })
                },
                MapList() {
                    var param = {};
                    param.projectNo = SiteConfig.account.projectNo;
                    param.pageno = this.pageno;
                    param.pagesize = 1000;
                    HttpUtil.get('ContingencyMap/MapList', param).success((res) => {
                        vuePage.MapData = res.data;
                    })
                },
                RiskList() {
                    var param = {};
                    param.projectNo = SiteConfig.account.projectNo;
                    param.pageno = 1;
                    param.pagesize = 1000;
                    HttpUtil.get('Risk/List', param).success((res) => {
                        vuePage.RiskData = res.data;
                    });
                }
            },
            created:

                function () {
                    $('.page').show();
                    this.headers = {
                        uid: SiteConfig.account.uId,
                        token: SiteConfig.account.accessToken
                    }
                    let proNo = HttpUtil.getQueryString('projectNo');
                    if (proNo) SiteConfig.account.projectNo = proNo;
                    HttpUtil.get('Department/List', {projectNo: SiteConfig.account.projectNo}).success((r) => {
                        if (r.state == 0) {
                            vuePage.DepartmentData = r.data;
                        }
                    })
                    this.getTrain();
                    this.RiskList();
                    this.MapList();
                }

            ,
            mounted: function () {
            }
        })
    ;


</script>

</body>
</html>
